1   /*
2    * UtilTest.java
3    * JUnit based test
4    *
5    * Created on 14 de Junho de 2005, 06:18
6    */
7   
8   package org.thema;
9   
10  import junit.framework.*;
11  
12  /***
13   *
14   * @author Eduardo M . Sasso
15   */
16  public class UtilTest extends TestCase {
17      
18      public UtilTest(String testName) {
19          super(testName);
20      }
21  
22      protected void setUp() throws Exception {
23      }
24  
25      protected void tearDown() throws Exception {
26      }
27  
28      public static Test suite() {
29          TestSuite suite = new TestSuite(UtilTest.class);
30          
31          return suite;
32      }
33  
34      /***
35       * Test of getTableName method, of class org.thema.Util.
36       */
37      public void testGetTableName() {
38          String sql = "select sysdate from dual";
39          String tableName = Util.getTableName(sql);
40          assertEquals(tableName,"dual",tableName);
41          
42          /*
43          sql = "select sysdate,username from dual,xxx";
44          tableName = Util.getTableName(sql);
45          assertEquals(tableName,"dual",tableName);
46          */
47          
48          sql = "select object_name,created,object_type from user_objects where rownum<10";
49          tableName = Util.getTableName(sql);
50          assertEquals("user_objects",tableName);
51      }
52      
53  }